package pers.qianyu.backup.config;

import org.springframework.context.annotation.*;
import org.springframework.web.servlet.config.annotation.*;
import pers.qianyu.backup.constants.*;

/**
 * @author mizzle rain
 * @date 2020-10-14 10:10
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {
    /**
     * 静态资源配置
     */
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        // 文件被保存的位置
        registry.addResourceHandler("/files/**")
                .addResourceLocations("file:"+ BackupConstants.BACKUP_FOLDER);
        // Knife4j 资源
        registry.addResourceHandler("doc.html")
                .addResourceLocations("classpath:/META-INF/resources/");
        registry.addResourceHandler("/webjars/**")
                .addResourceLocations("classpath:/META-INF/resources/webjars/");
    }
}
